//
// Created by sjjmw on 3/24/2022.
//
#include "iostream"
#include "vector"
#include "list"
#include "algorithm"
#include "string"
#include "unordered_map"
#include "cmath"
#include<iomanip>
#include "string"
#include "map"
#include "list"

//一个升序，一个降序
struct Sol{
    std::vector<int> vec;
    std::vector<char> took;
    void handle(int max,int b){
        vec.resize(b);
//        took.resize(b);
        int fz_cnt=0;
        for (int i = 0; i < b; ++i) {
            std::cin>>vec[i];
        }
        std::sort(vec.begin(),vec.end(),std::greater<int>());
        int took_cnt=0;
        int i=0,j=b-1;
        while(i<j){
            if(vec[i]+vec[j]<=max){
                i++;
                j--;
            }else{
                i++;
            }
            fz_cnt++;
        }
        if(i==j){
            fz_cnt++;
        }
//        while (took_cnt<took.size()){
//            int left_size=max;
//            int cnt=0;
//            for (int i = 0; i < took.size(); ++i) {
//                if(cnt<2&&vec[i]<=left_size){
//
//                    if(!took[i]){
//                        took[i]=1;
//                        took_cnt++;
//                        left_size-=vec[i];
//                        cnt++;
//                    }
//                }
//                if(cnt==2){
//                    break;
//                }
//            }
//            fz_cnt++;
//        }
        printf("%d\n",fz_cnt);
    }
};
int main(){
    int a,b,c;
    while(std::cin>>a>>b){
            Sol().handle(a,b);

    }

    return 0;
}